import { createSlice } from "@reduxjs/toolkit";
const getData = () => {
    return new Promise(resolve => {
        setTimeout(() => {
            resolve('async Name')
        }, 5000)
    })
}
export const appSlice = createSlice({
    name: 'app',
    initialState: {
        name: 'zhangsan',
        age: 12
    },
    reducers: {
        setAppName(state, {payload}) {
            state.name = payload
        }
    },
    extraReducers(builder) {
        
    }
})
// 导出 action 
export const { setAppName } = appSlice.actions
export default appSlice.reducer